package dao.major;

import java.util.List;

import util.paramvo.SearchParamVO;
import vo.MajorVO;

import com.ibatis.sqlmap.client.SqlMapClient;

public class MajorDAOImpl implements MajorDAO{

	private SqlMapClient sqlMapClient;

	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}

	@Override
	public List<MajorVO> getSearchedMajorByWord(SearchParamVO search) throws Exception {
		return sqlMapClient.queryForList("major.getSearchedMajorByWord", search);
	}

	@Override
	public int countSearchedMajorByWord(List<String> search) throws Exception {
		return (Integer) sqlMapClient.queryForObject("major.countSearchedMajorByWord", search);
	}

	@Override
	public void registerMajor(String major_name) throws Exception {
		sqlMapClient.insert("major.registerMajor", major_name);
	}

	@Override
	public void updateMajor(MajorVO param) throws Exception {
		sqlMapClient.update("major.updateMajor", param);
	}

	@Override
	public void deleteMajor(int major_no) throws Exception {
		sqlMapClient.update("major.deleteMajor", major_no);
	}
}
